const {analyApi,mockData} = require('../mockData');

const test = require('./testController');

if(false){
  // const map = {urls:{},fields:{}};
  const map = {urls:{"/common/test11":{result:"123"}},fields:{}};
  const r = analyApi('result',test[0].result,map,test[0].url,true);
  console.log(JSON.stringify(map,null,2));
  console.log(JSON.stringify(r[0],null,2));
  console.log(r[1]);
  console.log(mockData(r[0]));
}

if(false){
  // const map = {urls:{},fields:{}};
  const map = {urls:{},fields:{success:true}};
  const r = analyApi('result',test[1].result,map,test[1].url,true);
  console.log(JSON.stringify(map,null,2));
  console.log(JSON.stringify(r[0],null,2));
  console.log(r[1]);
  console.log(mockData(r[0]));
}

if(false){
  const map = {urls:{},fields:{a:["1","2"],param1:"1-2"}};
  // const map = {urls:{"/common/test11":{result:"123"}},fields:{}};
  const r = analyApi('result',test[2].result,map,test[2].url,true);
  console.log(JSON.stringify(map,null,2));
  console.log(JSON.stringify(r[0],null,2));
  console.log(r[1]);
  console.log(JSON.stringify(mockData(r[0]),null,2));
}
if(true){
  const map = {urls:{},fields:{a:["1","2"],param1:"1-10"}};
  // const map = {urls:{"/common/test11":{result:"123"}},fields:{}};
  const r = analyApi('result',{type:test[2].params},map,test[2].url,true);
  console.log(JSON.stringify(map,null,2));
  console.log(JSON.stringify(r[0],null,2));
  console.log(r[1]);
  console.log(JSON.stringify(mockData(r[0]),null,2));
}